package model

import "time"

const (
	Login = iota
	Logout
)

type LoginHistory struct {
	Id       int       `gorm:"primaryKey"`
	UId      int       `gorm:"column:uid;comment:用户UID"`
	CTime    time.Time `gorm:"column:ctime;comment:登录时间"`
	Ip       string    `gorm:"column:ip"`
	State    int8      `gorm:"column:state;comment:登录状态，0登录，1登出"`
	Hardware string    `gorm:"column:hardware;comment:hardware"`
}

type LoginLast struct {
	Id         int       `gorm:"primaryKey"`
	UId        int       `gorm:"column:uid;comment:用户UID"`
	LoginTime  time.Time `gorm:"column:login_time;comment:登录时间"`
	LogoutTime time.Time `gorm:"column:logout_time;comment:登出时间"`
	Ip         string    `gorm:"column:ip"`
	Session    string    `gorm:"column:session;comment:会话"`
	IsLogout   int8      `gorm:"column:is_logout;comment:是否logout,1:logout，0:login"`
	Hardware   string    `gorm:"column:hardware;comment:hardware"`
}

func (*LoginHistory) TableName() string {
	return "login_history"
}

func (*LoginLast) TableName() string {
	return "login_last"
}
